﻿using HandyControl.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WcsZz.Extend;

namespace NewWms.Views
{
    /// <summary>
    /// UpAndDownShelvesView.xaml 的交互逻辑
    /// </summary>
    public partial class UpAndDownShelvesView : UserControl
    {
        public UpAndDownShelvesView()
        {
            InitializeComponent();
        }
        //序号
 
        private void DgSceneRecord_LoadingRow2(object sender, DataGridRowEventArgs e)
        {
            e.Row.Header = e.Row.GetIndex() + 1;
        }
        //分页
        private void Pagination_PageUpdated(object sender, FunctionEventArgs<int> e)
        {
            string b = Convert.ToString(e.Info);
        }
        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox comboBox = (ComboBox)sender;
            ComboBoxItem selectedItem = comboBox.SelectedItem as ComboBoxItem;
            if (selectedItem != null)
            {
                // 获取ComboBox选中项的值
                string selectedValue = selectedItem.Content.ToString();
                // TODO: 处理ComboBox选中项的值
            }
        }

        //防止数字输入
        private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            short val;
            if (!Int16.TryParse(e.Text, out val))
                e.Handled = true;
        }
        private void TextBox_PreviewKeyDown2(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                MaterialProertyName.Focus();
                BoxCode2Name.Text = BoxCodeName.Text;
            }

        }





        private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                MaterialProertyName.Focus();
                BoxCode2Name.Text = BoxCodeName.Text;
            }
       
        }

        private void MaterialProertyName_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {           
                QuantityName.Focus();
            
            }
        }

        private void QuantityName_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                BoxCodeName.Focus();
                EventAggregatorHelper.EventAggregator.SendMessage("修改成功！", "新增物料");
                e.Handled = true;
            }
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
         
        }

        private void BoxCodeKeep_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                MaterialProeryNameKeep.Focus();
            }
        }

        private void MaterialProeryNameKeep_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                DelQuantityKeep.Focus();
            }
        }

        private void DelQuantityKeep_PreviewKeyDown(object sender, KeyEventArgs e)
        {

            if (e.Key == Key.Enter)
            {
                BoxCodeKeep.Focus();
                EventAggregatorHelper.EventAggregator.SendMessage("修改成功！", "删除物料");
            }
        
        }
    }
}
